package com.lee.study;


import dev.langchain4j.data.document.Document;
import dev.langchain4j.data.document.loader.FileSystemDocumentLoader;
import dev.langchain4j.data.document.parser.markdown.MarkdownDocumentParser;

import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.util.List;

public class MarkdownLoader {

    public static List<Document> loadDir(Path dir) {
        PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher("glob:*.txt");
        return FileSystemDocumentLoader.loadDocuments(dir, pathMatcher, new MarkdownDocumentParser());
    }

}
